/**
 * Created by 李柏霖
 * 2020/10/16 23:46
 */

package com.lbl.controller;

import com.lbl.domain.Person;
import com.lbl.service.IPersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

@Controller
@RequestMapping("/person")
public class PersonController {

    @Autowired
    private IPersonService personService;

    @RequestMapping(path = "/list",method = {RequestMethod.GET,RequestMethod.POST})
    public String list(Model model){
        //显示所有的person数据
        List<Person> list = personService.findAll();
        System.out.println(list);
        model.addAttribute("list",list);
        return "list";
    }
}
